﻿using Future.Shared.Core.Base;
using Futuret.Core.Futuret;
using Futuret.Sys.IService.Sys;
using Futuret.Sys.IService.Sys.Dto;

namespace Futuret.Sys.Web.Controllers.Sys;

/// <summary>
///     Author: Riva
///     Date: 2023/7/11 14:23
///     Description: 用户服务控制器
/// </summary>
public class SysUserController : BaseSysController
{
    private readonly ISysUserService _sysUserService;

    /// <summary>
    /// 
    /// </summary>
    /// <param name="sysUserService"></param>
    public SysUserController(ISysUserService sysUserService)
    {
        _sysUserService = sysUserService;
    }

    /// <summary>
    ///     新增用户信息
    /// </summary>
    [HttpPost]
    public async Task<WebResult> Add([FromBody] SysUserParamDto input)
    {
        await _sysUserService.Add(input);
        return WebResult.Success();
    }

    /// <summary>
    ///     分页查询用户信息
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    public async Task<WebResult> Edit([FromBody] SysUserParamDto input)
    {
        await _sysUserService.Edit(input);
        return WebResult.Success();
    }

    /// <summary>
    ///     分页查询用户信息
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    public async Task<WebResult> Delete([FromQuery] BaseInputIds input)
    {
        return WebResult.RetAppResult(await _sysUserService.Delete(input));
    }

    /// <summary>
    ///     分页查询用户信息
    /// </summary>
    /// <returns></returns>
    [HttpGet]
    public async Task<WebResult> Page([FromQuery] SysUserParamDto input)
    {
        return WebResult.Success(await _sysUserService.Page(input));
    }
}